import { post, getPage } from '../../request'

const ns = '/log' // namespace

interface Log {
  menuUrl: string
  menuName: string
  action?: string
  logType: string
}

export const logApi = {
  /**
   * 记录客户端访问及操作日志
   * @param data
   * @returns
   */
  create: (data: Log) => {
    return post({ url: `${ns}/user/pc`, data }, false)
  },

  /**
   * 查询分页Api日志列表
   * @param page
   * @param params
   * @returns
   */
  findApiListPage: (page: AxiosType.Pagination, params?: { [key: string]: any }) => {
    return getPage({ url: `${ns}/api`, params }, page)
  },

  /**
   * 查询分页访问日志列表
   * @param page
   * @param params
   * @returns
   */
  findUserListPage: (page: AxiosType.Pagination, params?: { [key: string]: any }) => {
    return getPage({ url: `${ns}/user`, params }, page)
  }
}
